<?php include_once "config/config.php"; session_start(); if (isset($_REQUEST['_SESSION'])) die("Get lost Muppet!");
if (!isset($_SESSION['stalas'])) {header('location:index.php');}
?>
<div>
    <span class="h2">Vartotojų sąskaitos</span>
    <div class="separator">&nbsp;</div>
    
    <form name="input" action="selectcheck.php" method="post">
        <div style="padding-top:10px;">
            <b>Išsirinkite vartotoją:</b><br/>          
            <select class="input_size" name="update_bill" id="update_bill" onchange="if (this.selectedIndex) submit();">
                <option><span>---</span></option>
                <?php
                    $id = $_SESSION['stalas'];
                    
                    $result = mysql_query("SELECT id, Vardas, Pavarde, Enabled FROM vartotojai ORDER BY id ASC");
                    $roles = mysql_query("SELECT VartotojaiId, RoleId FROM vartotojuroles");

                    while ($row = mysql_fetch_array($roles)) {
                        $vrole[$row['VartotojaiId']] = $row['RoleId'];
                    }
                    while ($row = mysql_fetch_array($result)) {
                        if($row['Enabled'] == 1 && $vrole[$row['id']] == 3)
                            echo ('<option value="'.$row['id'].'">'.$row['id'].') '.$row['Pavarde'].' '.$row['Vardas'].'</option>');
                    }
                ?>
            </select>
        </div>
            <br />
    </form>
            <div id="vartotojai_saskaitos"> 
                <!-- REZERVOUTA -->
            </div>
        
        <div style="clear:both;"></div>
    
</div>